home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / tc256d.zip / FLOOD.C < prev    next >
C/C++ Source or Header  |  1990-09-24  |  2KB  |  81 lines

  1. #include <dos.h>
  2. #include <graphics.h>
  3. #include <alloc.h>
  4. #include <stdlib.h>
  5.    int g_driver,g_mode,g_error;
  6.    int x;
  7.  
  8. static long stime ;               /* time-of-day from last call*/
  9.  
  10. struct PTS {
  11.   int x, y;
  12. };    /* Structure to hold vertex points    */
  13.  
  14. int jztimer(void) {        /* count elapsed time since last call (in ticks) */
  15. union REGS sreg , dreg ;
  16. long etime , delta ;
  17.  
  18.  sreg.x.ax = 0 ;             /* operation = get time count */
  19.  int86(0x1a,&sreg,&dreg);        /* do software interrupt */
  20.                        /* assemble 32-bit TOD value */
  21.  etime = ( ((long) dreg.x.cx) << 16 ) + dreg.x.dx;
  22.  delta = etime - stime ;
  23.  if( (dreg.x.ax & 0xff) != 0)       /* new day since last call? */
  24.     delta = delta + 0x01800B0L ;   /* yes-add 1 day in ticks*/
  25.  stime = etime ;               /* save TOD for next call */
  26.  return( (int) (delta / 18 )) ;          /* return as an integer */
  27. }
  28.  
  29.  
  30. void main() {
  31. char temp[20];
  32. int i;
  33.   struct PTS poly[ 6 ];        /* Space to hold datapoints    */
  34.  
  35.  printf("\nMode: ");
  36.  gets(temp);
  37.  g_mode = atoi(temp);
  38.     installuserdriver("ISVGA256",NULL);
  39.     g_driver = 134;
  40.     initgraph(&g_driver,&g_mode,"");
  41.  
  42.     g_error = graphresult();
  43.     if (g_error != 0) {
  44.        printf("%s \n",grapherrormsg(g_error));
  45.        exit(1);
  46.     }
  47.     settextstyle(0,HORIZ_DIR,1);
  48.     outtextxy(50,50,"Sample Text");
  49.     getch();
  50.  jztimer();
  51.     setfillstyle(SOLID_FILL,120);
  52.     setcolor(75);
  53.     fillellipse(85,75,50,50);
  54.     setcolor(3);
  55.     setfillstyle(EMPTY_FILL,0);
  56.     poly[0].x = 50;
  57.     poly[0].y = 50;
  58.     poly[1].x = 75;
  59.     poly[1].y = 30;
  60.     poly[2].x = 150;
  61.     poly[2].y = 50;
  62.     poly[3].x = 225;
  63.     poly[3].y = 18;
  64.     poly[4].x = 290;
  65.     poly[4].y = 150;
  66.     poly[5].x = 150;
  67.     poly[5].y = 100;
  68.     poly[6].x = 10;
  69.     poly[6].y = 180;
  70.     poly[7].x = 50;
  71.     poly[7].y = 50;
  72.     fillpoly( 8, (int far *)poly );    /* Draw the actual polygon        */
  73.  
  74.       setfillstyle(XHATCH_FILL,4);
  75.       floodfill(75,75,3);
  76.     getch();
  77.     restorecrtmode();
  78.  printf("\nIt took %d seconds to do 300 circles with our driver.\n", jztimer());
  79.  
  80. }
  81.